// Protocol3 商户渠道配置协议数据 - 服务商模式
// 从 protocols-channel-config.ts 迁移而来，转换为 Protocol3 格式

import { type MerchantChannelConfig3, ProtocolType3, FieldType } from '../types/protocol3-types'

// 微信支付服务商模式配置
const wechatProviderConfig: MerchantChannelConfig3 = {
  protocolId: 'PROTOCOL3_WECHAT_PROVIDER',
  protocolType: ProtocolType3.MERCHANT_CHANNEL_CONFIG_V3,
  channelCode: 'CHANNEL_IF_WECHAT',
  channelName: '微信支付',
  name: '微信支付服务商渠道配置',
  version: '3.0.0',
  description: '微信支付服务商渠道配置协议，支持服务商为子商户提供支付服务',
  configType: 'SERVICE_PROVIDER',
  configSections: [
    {
      sectionKey: 'basic',
      sectionName: '基础配置',
      description: '服务商基本信息配置',
      icon: 'SettingOutlined',
      order: 1,
      collapsed: false,
      fields: [
        {
          fieldKey: 'appId',
          fieldName: '服务商应用ID',
          fieldType: FieldType.INPUT,
          required: true,
          defaultValue: '',
          placeholder: '请输入微信服务商应用ID',
          description: '微信服务商应用ID',
          helpText: '格式：wx开头的18位字符串',
          validation: {
            pattern: '^wx[a-zA-Z0-9]{16}$',
            message: '应用ID格式不正确，应以wx开头，后跟16位字符'
          }
        },
        {
          fieldKey: 'mchId',
          fieldName: '服务商商户号',
          fieldType: FieldType.INPUT,
          required: true,
          defaultValue: '',
          placeholder: '请输入微信服务商商户号',
          description: '微信支付服务商商户号',
          helpText: '10位数字的商户号',
          validation: {
            pattern: '^[0-9]{10}$',
            message: '商户号应为10位数字'
          }
        },
        {
          fieldKey: 'apiKey',
          fieldName: 'API密钥',
          fieldType: FieldType.PASSWORD,
          required: true,
          defaultValue: '',
          placeholder: '请输入API密钥',
          description: '微信支付API密钥',
          helpText: '32位字符的API密钥',
          validation: {
            minLength: 32,
            maxLength: 32,
            message: 'API密钥长度应为32位'
          }
        },
        {
          fieldKey: 'apiVersion',
          fieldName: 'API版本',
          fieldType: FieldType.SELECT,
          required: true,
          defaultValue: 'v3',
          description: '微信支付API版本',
          options: [
            { label: 'API v3 (推荐)', value: 'v3' },
            { label: 'API v2', value: 'v2' }
          ]
        }
      ],
      defaultValues: {
        appId: '',
        mchId: '',
        apiKey: '',
        apiVersion: 'v3'
      }
    },
    {
      sectionKey: 'advanced',
      sectionName: '高级配置',
      description: '证书、回调等高级配置',
      icon: 'ToolOutlined',
      order: 2,
      collapsed: true,
      fields: [
        {
          fieldKey: 'certPath',
          fieldName: '证书文件',
          fieldType: FieldType.UPLOAD,
          required: false,
          defaultValue: '',
          placeholder: '上传证书文件（.p12格式）',
          description: '商户证书文件，用于退款等敏感操作',
          uiProps: {
            accept: '.p12,.pem',
            maxSize: 1024 * 1024 // 1MB
          }
        },
        {
          fieldKey: 'notifyUrl',
          fieldName: '回调地址',
          fieldType: FieldType.URL,
          required: false,
          defaultValue: '',
          placeholder: '请输入回调通知地址',
          description: '支付结果通知地址',
          validation: {
            pattern: '^https?://.*',
            message: '回调地址必须是有效的HTTP/HTTPS URL'
          }
        },
        {
          fieldKey: 'sandboxMode',
          fieldName: '运行模式',
          fieldType: FieldType.SELECT,
          required: true,
          defaultValue: 'false',
          description: '选择运行环境',
          options: [
            { label: '生产环境', value: 'false' },
            { label: '沙箱环境', value: 'true' }
          ]
        }
      ],
      defaultValues: {
        certPath: '',
        notifyUrl: '',
        sandboxMode: 'false'
      }
    }
  ],
  uiConfig: {
    layout: 'vertical',
    labelWidth: 120
  },
  metadata: {
    author: 'AnyPay Team',
    createTime: '2024-01-01',
    updateTime: '2024-01-15',
    tags: ['微信支付', '服务商模式'],
    category: '服务商模式',
    documentation: '微信支付服务商模式配置协议'
  },
  enabled: true
}

// 支付宝服务商模式配置
const alipayProviderConfig: MerchantChannelConfig3 = {
  protocolId: 'PROTOCOL3_ALIPAY_PROVIDER',
  protocolType: ProtocolType3.MERCHANT_CHANNEL_CONFIG_V3,
  channelCode: 'CHANNEL_IF_ALIPAY',
  channelName: '支付宝',
  name: '支付宝服务商渠道配置',
  version: '3.0.0',
  description: '支付宝服务商渠道配置协议',
  configType: 'SERVICE_PROVIDER',
  configSections: [
    {
      sectionKey: 'basic',
      sectionName: '基础配置',
      description: '服务商基本信息配置',
      icon: 'SettingOutlined',
      order: 1,
      collapsed: false,
      fields: [
        {
          fieldKey: 'appId',
          fieldName: '应用ID',
          fieldType: FieldType.INPUT,
          required: true,
          defaultValue: '',
          placeholder: '请输入支付宝应用ID',
          description: '支付宝开放平台应用ID',
          validation: {
            pattern: '^[0-9]{16}$',
            message: '应用ID应为16位数字'
          }
        },
        {
          fieldKey: 'pid',
          fieldName: '合作伙伴ID',
          fieldType: FieldType.INPUT,
          required: true,
          defaultValue: '',
          placeholder: '请输入合作伙伴ID',
          description: '支付宝合作伙伴ID',
          validation: {
            pattern: '^[0-9]{16}$',
            message: '合作伙伴ID应为16位数字'
          }
        },
        {
          fieldKey: 'privateKey',
          fieldName: '应用私钥',
          fieldType: FieldType.TEXTAREA,
          required: true,
          defaultValue: '',
          placeholder: '请输入应用私钥',
          description: '应用私钥，用于签名',
          uiProps: { rows: 6 },
          validation: {
            pattern: '^-----BEGIN (RSA )?PRIVATE KEY-----[\\s\\S]*-----END (RSA )?PRIVATE KEY-----$',
            message: '请输入有效的RSA私钥格式'
          }
        },
        {
          fieldKey: 'publicKey',
          fieldName: '支付宝公钥',
          fieldType: FieldType.TEXTAREA,
          required: true,
          defaultValue: '',
          placeholder: '请输入支付宝公钥',
          description: '支付宝公钥，用于验签',
          uiProps: { rows: 4 },
          validation: {
            pattern: '^-----BEGIN PUBLIC KEY-----[\\s\\S]*-----END PUBLIC KEY-----$',
            message: '请输入有效的公钥格式'
          }
        },
        {
          fieldKey: 'signType',
          fieldName: '签名算法',
          fieldType: FieldType.SELECT,
          required: true,
          defaultValue: 'RSA2',
          options: [
            { label: 'RSA', value: 'RSA' },
            { label: 'RSA2', value: 'RSA2' }
          ],
          description: '选择签名算法类型'
        }
      ],
      defaultValues: {
        appId: '',
        pid: '',
        privateKey: '',
        publicKey: '',
        signType: 'RSA2'
      }
    }
  ],
  uiConfig: {
    layout: 'vertical',
    labelWidth: 120
  },
  metadata: {
    author: 'AnyPay Team',
    createTime: '2024-01-01',
    updateTime: '2024-01-15',
    tags: ['支付宝', '服务商模式'],
    category: '服务商模式',
    documentation: '支付宝服务商模式配置协议'
  },
  enabled: true
}

// 乐刷支付服务商模式配置
const leshuaProviderConfig: MerchantChannelConfig3 = {
  protocolId: 'PROTOCOL3_LESHUA_PROVIDER',
  protocolType: ProtocolType3.MERCHANT_CHANNEL_CONFIG_V3,
  channelCode: 'CHANNEL_IF_LESHUA',
  channelName: '乐刷支付',
  name: '乐刷支付服务商渠道配置',
  version: '3.0.0',
  description: '乐刷支付服务商渠道配置协议，支持微信、支付宝等多种支付产品',
  configType: 'SERVICE_PROVIDER',
  configSections: [
    {
      sectionKey: 'merchant',
      sectionName: '商户信息',
      description: '乐刷支付商户基本信息配置',
      icon: 'IdcardOutlined',
      order: 1,
      collapsed: false,
      fields: [
        {
          fieldKey: 'merchantId',
          fieldName: '商户号',
          fieldType: FieldType.INPUT,
          required: true,
          defaultValue: '',
          placeholder: '请输入乐刷支付商户号',
          description: '乐刷支付分配的商户号',
          helpText: '格式：10-15位数字',
          validation: {
            pattern: '^[0-9]{10,15}$',
            message: '商户号应为10-15位数字'
          }
        },
        {
          fieldKey: 'terminalId',
          fieldName: '终端号',
          fieldType: FieldType.INPUT,
          required: true,
          defaultValue: '',
          placeholder: '请输入终端号',
          description: '乐刷支付分配的终端号',
          helpText: '格式：8-12位数字',
          validation: {
            pattern: '^[0-9]{8,12}$',
            message: '终端号应为8-12位数字'
          }
        },
        {
          fieldKey: 'appId',
          fieldName: '应用ID',
          fieldType: FieldType.INPUT,
          required: true,
          defaultValue: '',
          placeholder: '请输入应用ID',
          description: '乐刷支付分配的应用ID',
          helpText: '乐刷平台生成的应用标识符'
        }
      ],
      defaultValues: {
        merchantId: '',
        terminalId: '',
        appId: ''
      }
    },
    {
      sectionKey: 'security',
      sectionName: '安全配置',
      description: '乐刷支付签名和验签配置',
      icon: 'SafetyOutlined',
      order: 2,
      collapsed: false,
      fields: [
        {
          fieldKey: 'signKey',
          fieldName: '签名密钥',
          fieldType: FieldType.PASSWORD,
          required: true,
          defaultValue: '',
          placeholder: '请输入签名密钥',
          description: '用于API请求签名的密钥',
          helpText: '长度应在16-64个字符之间',
          validation: {
            minLength: 16,
            maxLength: 64,
            message: '签名密钥长度应在16-64个字符之间'
          }
        },
        {
          fieldKey: 'signType',
          fieldName: '签名方式',
          fieldType: FieldType.SELECT,
          required: true,
          defaultValue: 'MD5',
          description: '签名算法类型',
          options: [
            { label: 'MD5 (推荐)', value: 'MD5' },
            { label: 'SHA256', value: 'SHA256' },
            { label: 'RSA', value: 'RSA' }
          ]
        },
        {
          fieldKey: 'version',
          fieldName: 'API版本',
          fieldType: FieldType.SELECT,
          required: true,
          defaultValue: '3.0',
          description: '乐刷支付API版本',
          options: [
            { label: '3.0 (最新)', value: '3.0' },
            { label: '2.0', value: '2.0' },
            { label: '1.0', value: '1.0' }
          ]
        }
      ],
      defaultValues: {
        signKey: '',
        signType: 'MD5',
        version: '3.0'
      }
    },
    {
      sectionKey: 'callback',
      sectionName: '回调配置',
      description: '支付结果通知和回调地址配置',
      icon: 'LinkOutlined',
      order: 3,
      collapsed: false,
      fields: [
        {
          fieldKey: 'notifyUrl',
          fieldName: '异步通知地址',
          fieldType: FieldType.URL,
          required: true,
          defaultValue: '',
          placeholder: 'https://your-domain.com/notify/leshua',
          description: '接收支付结果异步通知的地址',
          validation: {
            pattern: '^https?://.*',
            message: '异步通知地址必须是有效的HTTP/HTTPS URL'
          }
        },
        {
          fieldKey: 'returnUrl',
          fieldName: '同步返回地址',
          fieldType: FieldType.URL,
          required: false,
          defaultValue: '',
          placeholder: 'https://your-domain.com/return/leshua',
          description: '支付完成后的页面跳转地址'
        }
      ],
      defaultValues: {
        notifyUrl: '',
        returnUrl: ''
      }
    },
    {
      sectionKey: 'products',
      sectionName: '产品配置',
      description: '乐刷支付支持的产品类型配置',
      icon: 'AppstoreOutlined',
      order: 4,
      collapsed: true,
      fields: [
        {
          fieldKey: 'supportedProducts',
          fieldName: '支持产品',
          fieldType: FieldType.CHECKBOX,
          required: true,
          defaultValue: ['WECHAT_NATIVE', 'ALIPAY_NATIVE'],
          description: '选择支持的产品类型（可多选）',
          options: [
            { label: '微信扫码支付', value: 'WECHAT_NATIVE' },
            { label: '微信APP支付', value: 'WECHAT_APP' },
            { label: '微信小程序支付', value: 'WECHAT_JSAPI' },
            { label: '微信H5支付', value: 'WECHAT_H5' },
            { label: '支付宝扫码支付', value: 'ALIPAY_NATIVE' },
            { label: '支付宝APP支付', value: 'ALIPAY_APP' },
            { label: '支付宝H5支付', value: 'ALIPAY_H5' }
          ]
        },
        {
          fieldKey: 'terminalType',
          fieldName: '终端类型',
          fieldType: FieldType.SELECT,
          required: true,
          defaultValue: '01',
          description: '终端设备类型',
          options: [
            { label: '01 - 智能POS', value: '01' },
            { label: '02 - 传统POS', value: '02' },
            { label: '03 - 扫码枪', value: '03' },
            { label: '04 - 手机APP', value: '04' },
            { label: '05 - 网页支付', value: '05' }
          ]
        }
      ],
      defaultValues: {
        supportedProducts: ['WECHAT_NATIVE', 'ALIPAY_NATIVE'],
        terminalType: '01'
      }
    },
    {
      sectionKey: 'advanced',
      sectionName: '高级配置',
      description: '乐刷支付高级功能配置',
      icon: 'SettingOutlined',
      order: 5,
      collapsed: true,
      fields: [
        {
          fieldKey: 'timeout',
          fieldName: '超时时间',
          fieldType: FieldType.NUMBER,
          required: false,
          defaultValue: 30,
          placeholder: '30',
          description: '支付超时时间(秒)',
          validation: {
            min: 10,
            max: 300,
            message: '超时时间应在10-300秒之间'
          }
        },
        {
          fieldKey: 'sandboxMode',
          fieldName: '沙箱模式',
          fieldType: FieldType.SELECT,
          required: true,
          defaultValue: 'false',
          description: '是否启用沙箱测试环境',
          options: [
            { label: '生产环境', value: 'false' },
            { label: '沙箱环境', value: 'true' }
          ]
        },
        {
          fieldKey: 'encoding',
          fieldName: '字符编码',
          fieldType: FieldType.SELECT,
          required: true,
          defaultValue: 'UTF-8',
          description: 'API请求字符编码',
          options: [
            { label: 'UTF-8', value: 'UTF-8' },
            { label: 'GBK', value: 'GBK' },
            { label: 'GB2312', value: 'GB2312' }
          ]
        }
      ],
      defaultValues: {
        timeout: 30,
        sandboxMode: 'false',
        encoding: 'UTF-8'
      }
    }
  ],
  uiConfig: {
    layout: 'vertical',
    labelWidth: 120
  },
  metadata: {
    author: 'AnyPay Team',
    createTime: '2024-01-15',
    updateTime: '2024-01-15',
    tags: ['乐刷支付', '服务商模式', '第三方渠道', '微信支付', '支付宝'],
    category: '服务商模式',
    documentation: '乐刷支付是国内知名的第三方支付平台，支持微信支付、支付宝等多种支付方式'
  },
  enabled: true
}

// 银联支付服务商模式配置
const unionpayProviderConfig: MerchantChannelConfig3 = {
  protocolId: 'PROTOCOL3_UNIONPAY_PROVIDER',
  protocolType: ProtocolType3.MERCHANT_CHANNEL_CONFIG_V3,
  channelCode: 'CHANNEL_IF_UNIONPAY',
  channelName: '银联支付',
  name: '中国银联支付服务商配置',
  version: '3.0.0',
  description: '中国银联支付服务商渠道配置协议，支持多种产品类型和复杂业务场景',
  configType: 'SERVICE_PROVIDER',
  configSections: [
    {
      sectionKey: 'merchant',
      sectionName: '商户信息',
      description: '银联商户基本信息配置',
      icon: 'IdcardOutlined',
      order: 1,
      collapsed: false,
      fields: [
        {
          fieldKey: 'merId',
          fieldName: '商户号',
          fieldType: FieldType.INPUT,
          required: true,
          defaultValue: '',
          placeholder: '请输入银联分配的商户号',
          description: '银联分配的15位商户号',
          helpText: '格式：15位数字',
          validation: {
            pattern: '^[0-9]{15}$',
            message: '商户号必须为15位数字'
          }
        },
        {
          fieldKey: 'merName',
          fieldName: '商户名称',
          fieldType: FieldType.INPUT,
          required: true,
          defaultValue: '',
          placeholder: '请输入商户名称',
          description: '在银联注册的商户名称',
          helpText: '不超过100个字符',
          validation: {
            maxLength: 100,
            message: '商户名称不能超过100个字符'
          }
        },
        {
          fieldKey: 'industryCode',
          fieldName: '行业代码',
          fieldType: FieldType.SELECT,
          required: true,
          defaultValue: '5311',
          description: '商户所属行业分类代码',
          options: [
            { label: '5311 - 百货商店', value: '5311' },
            { label: '5411 - 超市', value: '5411' },
            { label: '5812 - 餐饮', value: '5812' },
            { label: '5999 - 其他零售', value: '5999' },
            { label: '6011 - 银行', value: '6011' },
            { label: '7011 - 酒店', value: '7011' }
          ]
        }
      ],
      defaultValues: {
        merId: '',
        merName: '',
        industryCode: '5311'
      }
    },
    {
      sectionKey: 'security',
      sectionName: '安全配置',
      description: '证书和密钥安全配置',
      icon: 'SafetyOutlined',
      order: 2,
      collapsed: false,
      fields: [
        {
          fieldKey: 'signCertId',
          fieldName: '签名证书ID',
          fieldType: FieldType.INPUT,
          required: true,
          defaultValue: '',
          placeholder: '请输入签名证书ID',
          description: '银联颁发的签名证书序列号'
        },
        {
          fieldKey: 'signCertPath',
          fieldName: '签名证书',
          fieldType: FieldType.UPLOAD,
          required: true,
          defaultValue: '',
          placeholder: '上传签名证书文件',
          description: '银联颁发的签名证书文件',
          uiProps: {
            accept: '.cer,.pem',
            maxSize: 1024 * 1024 // 1MB
          }
        },
        {
          fieldKey: 'encryptCertPath',
          fieldName: '加密证书',
          fieldType: FieldType.UPLOAD,
          required: false,
          defaultValue: '',
          placeholder: '上传加密证书文件',
          description: '银联公钥加密证书',
          uiProps: {
            accept: '.cer,.pem',
            maxSize: 1024 * 1024 // 1MB
          }
        }
      ],
      defaultValues: {
        signCertId: '',
        signCertPath: '',
        encryptCertPath: ''
      }
    }
  ],
  uiConfig: {
    layout: 'vertical',
    labelWidth: 120
  },
  metadata: {
    author: 'AnyPay Team',
    createTime: '2024-01-01',
    updateTime: '2024-01-15',
    tags: ['银联支付', '服务商模式'],
    category: '服务商模式',
    documentation: '中国银联支付服务商模式配置协议'
  },
  enabled: true
}

// 易宝支付服务商模式配置
const yeepayProviderConfig: MerchantChannelConfig3 = {
  protocolId: 'PROTOCOL3_YEEPAY_PROVIDER',
  protocolType: ProtocolType3.MERCHANT_CHANNEL_CONFIG_V3,
  channelCode: 'CHANNEL_IF_YEEPAY',
  channelName: '易宝支付',
  name: '易宝支付服务商配置',
  version: '3.0.0',
  description: '易宝支付服务商渠道配置协议，支持多种支付产品和场景',
  configType: 'SERVICE_PROVIDER',
  configSections: [
    {
      sectionKey: 'merchant',
      sectionName: '商户信息',
      description: '易宝支付商户基本信息配置',
      icon: 'IdcardOutlined',
      order: 1,
      collapsed: false,
      fields: [
        {
          fieldKey: 'merchantNo',
          fieldName: '商户编号',
          fieldType: FieldType.INPUT,
          required: true,
          defaultValue: '',
          placeholder: '请输入易宝支付商户编号',
          description: '易宝支付分配的商户编号',
          helpText: '格式：8-16位字符',
          validation: {
            pattern: '^[0-9A-Z]{8,16}$',
            message: '商户编号格式不正确'
          }
        },
        {
          fieldKey: 'appKey',
          fieldName: '应用Key',
          fieldType: FieldType.INPUT,
          required: true,
          defaultValue: '',
          placeholder: '请输入应用Key',
          description: '易宝支付分配的应用Key'
        },
        {
          fieldKey: 'appSecret',
          fieldName: '应用密钥',
          fieldType: FieldType.PASSWORD,
          required: true,
          defaultValue: '',
          placeholder: '请输入应用密钥',
          description: '易宝支付应用密钥',
          helpText: '用于签名和验签',
          validation: {
            minLength: 16,
            message: '应用密钥长度不能少于16位'
          }
        }
      ],
      defaultValues: {
        merchantNo: '',
        appKey: '',
        appSecret: ''
      }
    },
    {
      sectionKey: 'advanced',
      sectionName: '高级配置',
      description: '超时、环境等高级配置',
      icon: 'SettingOutlined',
      order: 2,
      collapsed: true,
      fields: [
        {
          fieldKey: 'timeout',
          fieldName: '超时时间',
          fieldType: FieldType.NUMBER,
          required: false,
          defaultValue: 30,
          placeholder: '30',
          description: '请求超时时间(秒)',
          validation: {
            min: 5,
            max: 120,
            message: '超时时间应在5-120秒之间'
          }
        },
        {
          fieldKey: 'environment',
          fieldName: '运行环境',
          fieldType: FieldType.SELECT,
          required: true,
          defaultValue: 'PROD',
          description: '选择运行环境',
          options: [
            { label: '生产环境', value: 'PROD' },
            { label: '测试环境', value: 'TEST' }
          ]
        }
      ],
      defaultValues: {
        timeout: 30,
        environment: 'PROD'
      }
    }
  ],
  uiConfig: {
    layout: 'vertical',
    labelWidth: 120
  },
  metadata: {
    author: 'AnyPay Team',
    createTime: '2024-01-01',
    updateTime: '2024-01-15',
    tags: ['易宝支付', '服务商模式'],
    category: '服务商模式',
    documentation: '易宝支付服务商模式配置协议'
  },
  enabled: true
}

// 汇付天下服务商模式配置
const huifuProviderConfig: MerchantChannelConfig3 = {
  protocolId: 'PROTOCOL3_HUIFU_PROVIDER',
  protocolType: ProtocolType3.MERCHANT_CHANNEL_CONFIG_V3,
  channelCode: 'CHANNEL_IF_HUIFU',
  channelName: '汇付天下',
  name: '汇付天下服务商渠道配置',
  version: '3.0.0',
  description: '汇付天下服务商渠道配置协议，支持微信、支付宝等多种支付产品',
  configType: 'SERVICE_PROVIDER',
  configSections: [
    {
      sectionKey: 'merchant',
      sectionName: '商户信息',
      description: '汇付天下商户基本信息配置',
      icon: 'IdcardOutlined',
      order: 1,
      collapsed: false,
      fields: [
        {
          fieldKey: 'merchantId',
          fieldName: '商户号',
          fieldType: FieldType.INPUT,
          required: true,
          defaultValue: '',
          placeholder: '请输入汇付天下商户号',
          description: '汇付天下分配的商户号',
          helpText: '格式：HF开头后跟10-16位字符',
          validation: {
            pattern: '^HF[0-9A-Z]{10,16}$',
            message: '商户号格式不正确，应为HF开头'
          }
        },
        {
          fieldKey: 'apiKey',
          fieldName: 'API密钥',
          fieldType: FieldType.PASSWORD,
          required: true,
          defaultValue: '',
          placeholder: '请输入API密钥',
          description: '汇付天下API调用密钥',
          helpText: '不少于32位',
          validation: {
            minLength: 32,
            message: 'API密钥长度不能少于32位'
          }
        },
        {
          fieldKey: 'secretKey',
          fieldName: '签名密钥',
          fieldType: FieldType.PASSWORD,
          required: true,
          defaultValue: '',
          placeholder: '请输入签名密钥',
          description: '用于签名验证的密钥',
          helpText: '不少于32位',
          validation: {
            minLength: 32,
            message: '签名密钥长度不能少于32位'
          }
        }
      ],
      defaultValues: {
        merchantId: '',
        apiKey: '',
        secretKey: ''
      }
    },
    {
      sectionKey: 'advanced',
      sectionName: '高级配置',
      description: '回调地址和环境配置',
      icon: 'ToolOutlined',
      order: 2,
      collapsed: true,
      fields: [
        {
          fieldKey: 'notifyUrl',
          fieldName: '回调地址',
          fieldType: FieldType.URL,
          required: false,
          defaultValue: '',
          placeholder: '请输入回调地址',
          description: '支付结果通知地址',
          validation: {
            pattern: '^https?://.*',
            message: '请输入有效的HTTP/HTTPS URL'
          }
        },
        {
          fieldKey: 'sandboxMode',
          fieldName: '沙箱模式',
          fieldType: FieldType.SELECT,
          required: false,
          defaultValue: 'false',
          description: '是否启用沙箱环境',
          options: [
            { label: '关闭', value: 'false' },
            { label: '开启', value: 'true' }
          ]
        }
      ],
      defaultValues: {
        notifyUrl: '',
        sandboxMode: 'false'
      }
    }
  ],
  uiConfig: {
    layout: 'vertical',
    labelWidth: 120
  },
  metadata: {
    author: 'AnyPay Team',
    createTime: '2024-01-01',
    updateTime: '2024-01-15',
    tags: ['汇付天下', '服务商模式'],
    category: '服务商模式',
    documentation: '汇付天下服务商模式配置协议'
  },
  enabled: true
}

// 斗拱支付服务商模式配置
const dougongProviderConfig: MerchantChannelConfig3 = {
  protocolId: 'PROTOCOL3_DOUGONG_PROVIDER',
  protocolType: ProtocolType3.MERCHANT_CHANNEL_CONFIG_V3,
  channelCode: 'CHANNEL_IF_DOUGONG',
  channelName: '斗拱支付',
  name: '斗拱支付服务商渠道配置',
  version: '3.0.0',
  description: '斗拱支付服务商渠道配置协议，支持微信、支付宝等多种支付产品',
  configType: 'SERVICE_PROVIDER',
  configSections: [
    {
      sectionKey: 'merchant',
      sectionName: '商户信息',
      description: '斗拱支付商户基本信息配置',
      icon: 'IdcardOutlined',
      order: 1,
      collapsed: false,
      fields: [
        {
          fieldKey: 'merchantId',
          fieldName: '商户号',
          fieldType: FieldType.INPUT,
          required: true,
          defaultValue: '',
          placeholder: '请输入斗拱支付商户号',
          description: '斗拱支付分配的商户号',
          helpText: '格式：DG开头后跟8-12位数字',
          validation: {
            pattern: '^DG[0-9]{8,12}$',
            message: '商户号格式不正确，应为DG开头'
          }
        },
        {
          fieldKey: 'apiKey',
          fieldName: 'API密钥',
          fieldType: FieldType.PASSWORD,
          required: true,
          defaultValue: '',
          placeholder: '请输入API密钥',
          description: '斗拱支付分配的API密钥',
          helpText: '长度应在32-64位之间',
          validation: {
            minLength: 32,
            maxLength: 64,
            message: 'API密钥长度应在32-64位之间'
          }
        },
        {
          fieldKey: 'secretKey',
          fieldName: '签名密钥',
          fieldType: FieldType.PASSWORD,
          required: true,
          defaultValue: '',
          placeholder: '请输入签名密钥',
          description: '用于签名验证的密钥',
          helpText: '长度应在32-64位之间',
          validation: {
            minLength: 32,
            maxLength: 64,
            message: '签名密钥长度应在32-64位之间'
          }
        }
      ],
      defaultValues: {
        merchantId: '',
        apiKey: '',
        secretKey: ''
      }
    },
    {
      sectionKey: 'advanced',
      sectionName: '高级配置',
      description: '回调地址和环境配置',
      icon: 'ToolOutlined',
      order: 2,
      collapsed: true,
      fields: [
        {
          fieldKey: 'notifyUrl',
          fieldName: '回调地址',
          fieldType: FieldType.URL,
          required: false,
          defaultValue: '',
          placeholder: '请输入回调地址',
          description: '支付结果通知地址',
          validation: {
            pattern: '^https?://.*',
            message: '请输入有效的HTTP/HTTPS URL'
          }
        },
        {
          fieldKey: 'sandboxMode',
          fieldName: '沙箱模式',
          fieldType: FieldType.SELECT,
          required: false,
          defaultValue: 'false',
          description: '是否启用沙箱环境',
          options: [
            { label: '关闭', value: 'false' },
            { label: '开启', value: 'true' }
          ]
        }
      ],
      defaultValues: {
        notifyUrl: '',
        sandboxMode: 'false'
      }
    }
  ],
  uiConfig: {
    layout: 'vertical',
    labelWidth: 120
  },
  metadata: {
    author: 'AnyPay Team',
    createTime: '2024-01-01',
    updateTime: '2024-01-15',
    tags: ['斗拱支付', '服务商模式'],
    category: '服务商模式',
    documentation: '斗拱支付服务商模式配置协议'
  },
  enabled: true
}

// 拉卡拉服务商模式配置
const lakalaProviderConfig: MerchantChannelConfig3 = {
  protocolId: 'PROTOCOL3_LAKALA_PROVIDER',
  protocolType: ProtocolType3.MERCHANT_CHANNEL_CONFIG_V3,
  channelCode: 'CHANNEL_IF_LAKALA',
  channelName: '拉卡拉',
  name: '拉卡拉服务商渠道配置',
  version: '3.0.0',
  description: '拉卡拉服务商渠道配置协议，支持微信、支付宝等多种支付产品',
  configType: 'SERVICE_PROVIDER',
  configSections: [
    {
      sectionKey: 'merchant',
      sectionName: '商户信息',
      description: '拉卡拉商户基本信息配置',
      icon: 'IdcardOutlined',
      order: 1,
      collapsed: false,
      fields: [
        {
          fieldKey: 'merchantId',
          fieldName: '商户号',
          fieldType: FieldType.INPUT,
          required: true,
          defaultValue: '',
          placeholder: '请输入拉卡拉商户号',
          description: '拉卡拉分配的商户号',
          helpText: '格式：LKL开头后跟10-15位数字',
          validation: {
            pattern: '^LKL[0-9]{10,15}$',
            message: '商户号格式不正确，应为LKL开头'
          }
        },
        {
          fieldKey: 'terminalId',
          fieldName: '终端号',
          fieldType: FieldType.INPUT,
          required: true,
          defaultValue: '',
          placeholder: '请输入终端号',
          description: '拉卡拉分配的终端号',
          helpText: '格式：8-12位数字',
          validation: {
            pattern: '^[0-9]{8,12}$',
            message: '终端号应为8-12位数字'
          }
        },
        {
          fieldKey: 'apiKey',
          fieldName: 'API密钥',
          fieldType: FieldType.PASSWORD,
          required: true,
          defaultValue: '',
          placeholder: '请输入API密钥',
          description: '拉卡拉API调用密钥',
          helpText: '不少于32位',
          validation: {
            minLength: 32,
            message: 'API密钥长度不能少于32位'
          }
        },
        {
          fieldKey: 'secretKey',
          fieldName: '签名密钥',
          fieldType: FieldType.PASSWORD,
          required: true,
          defaultValue: '',
          placeholder: '请输入签名密钥',
          description: '用于签名验证的密钥',
          helpText: '不少于32位',
          validation: {
            minLength: 32,
            message: '签名密钥长度不能少于32位'
          }
        }
      ],
      defaultValues: {
        merchantId: '',
        terminalId: '',
        apiKey: '',
        secretKey: ''
      }
    },
    {
      sectionKey: 'advanced',
      sectionName: '高级配置',
      description: '回调地址和环境配置',
      icon: 'ToolOutlined',
      order: 2,
      collapsed: true,
      fields: [
        {
          fieldKey: 'notifyUrl',
          fieldName: '回调地址',
          fieldType: FieldType.URL,
          required: false,
          defaultValue: '',
          placeholder: '请输入回调地址',
          description: '支付结果通知地址',
          validation: {
            pattern: '^https?://.*',
            message: '请输入有效的HTTP/HTTPS URL'
          }
        },
        {
          fieldKey: 'sandboxMode',
          fieldName: '沙箱模式',
          fieldType: FieldType.SELECT,
          required: false,
          defaultValue: 'false',
          description: '是否启用沙箱环境',
          options: [
            { label: '关闭', value: 'false' },
            { label: '开启', value: 'true' }
          ]
        }
      ],
      defaultValues: {
        notifyUrl: '',
        sandboxMode: 'false'
      }
    }
  ],
  uiConfig: {
    layout: 'vertical',
    labelWidth: 120
  },
  metadata: {
    author: 'AnyPay Team',
    createTime: '2024-01-01',
    updateTime: '2024-01-15',
    tags: ['拉卡拉', '服务商模式'],
    category: '服务商模式',
    documentation: '拉卡拉服务商模式配置协议'
  },
  enabled: true
}

// 富友支付服务商模式配置
const fuiouProviderConfig: MerchantChannelConfig3 = {
  protocolId: 'PROTOCOL3_FUIOU_PROVIDER',
  protocolType: ProtocolType3.MERCHANT_CHANNEL_CONFIG_V3,
  channelCode: 'CHANNEL_IF_FUIOU',
  channelName: '富友支付',
  name: '富友支付服务商渠道配置',
  version: '3.0.0',
  description: '富友支付服务商渠道配置协议，支持微信、支付宝等多种支付产品',
  configType: 'SERVICE_PROVIDER',
  configSections: [
    {
      sectionKey: 'merchant',
      sectionName: '商户信息',
      description: '富友支付商户基本信息配置',
      icon: 'IdcardOutlined',
      order: 1,
      collapsed: false,
      fields: [
        {
          fieldKey: 'merchantId',
          fieldName: '商户号',
          fieldType: FieldType.INPUT,
          required: true,
          defaultValue: '',
          placeholder: '请输入富友支付商户号',
          description: '富友支付分配的商户号',
          helpText: '格式：FY开头后跟10-15位数字',
          validation: {
            pattern: '^FY[0-9]{10,15}$',
            message: '商户号格式不正确，应为FY开头'
          }
        },
        {
          fieldKey: 'instCode',
          fieldName: '机构代码',
          fieldType: FieldType.INPUT,
          required: true,
          defaultValue: '',
          placeholder: '请输入机构代码',
          description: '富友支付分配的机构代码',
          helpText: '格式：6-12位字符',
          validation: {
            pattern: '^[0-9A-Z]{6,12}$',
            message: '机构代码格式不正确'
          }
        },
        {
          fieldKey: 'apiKey',
          fieldName: 'API密钥',
          fieldType: FieldType.PASSWORD,
          required: true,
          defaultValue: '',
          placeholder: '请输入API密钥',
          description: '富友支付API调用密钥',
          helpText: '不少于32位',
          validation: {
            minLength: 32,
            message: 'API密钥长度不能少于32位'
          }
        },
        {
          fieldKey: 'secretKey',
          fieldName: '签名密钥',
          fieldType: FieldType.PASSWORD,
          required: true,
          defaultValue: '',
          placeholder: '请输入签名密钥',
          description: '用于签名验证的密钥',
          helpText: '不少于32位',
          validation: {
            minLength: 32,
            message: '签名密钥长度不能少于32位'
          }
        }
      ],
      defaultValues: {
        merchantId: '',
        instCode: '',
        apiKey: '',
        secretKey: ''
      }
    },
    {
      sectionKey: 'advanced',
      sectionName: '高级配置',
      description: '回调地址和环境配置',
      icon: 'ToolOutlined',
      order: 2,
      collapsed: true,
      fields: [
        {
          fieldKey: 'notifyUrl',
          fieldName: '回调地址',
          fieldType: FieldType.URL,
          required: false,
          defaultValue: '',
          placeholder: '请输入回调地址',
          description: '支付结果通知地址',
          validation: {
            pattern: '^https?://.*',
            message: '请输入有效的HTTP/HTTPS URL'
          }
        },
        {
          fieldKey: 'sandboxMode',
          fieldName: '沙箱模式',
          fieldType: FieldType.SELECT,
          required: false,
          defaultValue: 'false',
          description: '是否启用沙箱环境',
          options: [
            { label: '关闭', value: 'false' },
            { label: '开启', value: 'true' }
          ]
        }
      ],
      defaultValues: {
        notifyUrl: '',
        sandboxMode: 'false'
      }
    }
  ],
  uiConfig: {
    layout: 'vertical',
    labelWidth: 120
  },
  metadata: {
    author: 'AnyPay Team',
    createTime: '2024-01-01',
    updateTime: '2024-01-15',
    tags: ['富友支付', '服务商模式'],
    category: '服务商模式',
    documentation: '富友支付服务商模式配置协议'
  },
  enabled: true
}

// 导出服务商模式协议数据数组
export const protocol3ProviderConfigs: MerchantChannelConfig3[] = [
  wechatProviderConfig,
  alipayProviderConfig,
  leshuaProviderConfig,
  unionpayProviderConfig,
  yeepayProviderConfig,
  huifuProviderConfig,
  dougongProviderConfig,
  lakalaProviderConfig,
  fuiouProviderConfig
]